package com.foreknow.mapping;

import java.util.HashMap;
import java.util.Map;

public class MappingFactory {
    private static MappingFactory mappingFactory;
    private Map<String,EntityMapping> maps = new HashMap<>();
    public static final String SYS_USER_MAPPING = "sys_userMapping";
    public static final String ADMIN_MAPPING = "adminMapping";
    public static final String GUESTBOOK_MAPPING = "guestbookMapping";
    private MappingFactory(){
    }

    public static MappingFactory getInstance(){
        if (mappingFactory == null) {
            mappingFactory = new MappingFactory();
        }
        mappingFactory.maps.put(SYS_USER_MAPPING,new Sys_userMapping());
        mappingFactory.maps.put(ADMIN_MAPPING,new AdminMapping());
        mappingFactory.maps.put(GUESTBOOK_MAPPING,new GuestbookMapping());
        return mappingFactory;
    }

    public EntityMapping getMapping(String key){
        return maps.get(key) ;
    }
}
